home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / GameKit / Headers / gamekit / GameBrain.h < prev    next >
Text File  |  1995-06-12  |  6KB  |  126 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. // This handles a lot of the logic of the game; it has application delegate
  5. // methods to deal with start up and shut down of the application.  It also
  6. // has some window delegate methods that work in conjunction with the game
  7. // window (window with the playing field).  It starts and stops the game,
  8. // odes pausing, makes sure initialization is done properly, moves from
  9. // level to level, and tracks the score along with various bonuses.
  10.  
  11. #import <appkit/appkit.h>
  12.  
  13.  
  14. // These next #defines are for arguments to the -askAbortGame: method
  15. // Here are some reasons why (or ways that) you might abort a game:
  16. #define GK_ABORT    0    // user initiated abort (start new game or abort)
  17. #define GK_EXIT        1    // exiting the program
  18.  
  19.  
  20. // Following are subtypes for the compound field of the even data in app-
  21. // defined events.  You can use your own subtypes as well...just start them
  22. // at GK_USER_BASE
  23. #define GK_EVENT_BASE 1        // start of the GK defined events
  24.  
  25. #define GK_NONE 0                    // NULL GK app-defined event
  26. #define GK_STARTUP GK_EVENT_BASE
  27.  
  28. #define GK_USER_BASE GK_EVENT_BASE + 1
  29.             // if you define your own events, they should be declared as
  30.             // (GK_USERBASE + xxx) where xxx is your event number
  31.             // (which should be in the range from 0 to 65534-GK_USER_BASE);
  32.             // that way, if new events are added to the GameKit, you won't
  33.             // get any weird behaviors!
  34.  
  35.  
  36. @interface GameBrain:Object
  37. {
  38.     id  scorePlayer;        // plays music
  39.     id  soundPlayer;        // plays sound files
  40.     id  scoreKeeper;        // keeps score for the game
  41.     id  oneUpView;            // keeps track of "extra men"
  42.     id    strings;            // localized strings in .nib
  43.     id    alert;                // tells user to wait during load
  44.     id    levelText;            // textField on status window
  45.     id    gameScreen;            // gameView instance    
  46.     id    gameTimer;            // gameView instance    
  47.     id  pauseMenuCell;        // menuCell that pauses/unpauses game
  48.     id  gameWindow;            // window holding gameView
  49.     id  gameInfo;            // window holding gameView
  50.     id    highScoreController;    // object to handle High Scores
  51.     id  preferencesBrain;    // object to handle Preferences Panel
  52.     id  infoController;        // object to put out info/help panels
  53.     id  loadingPanel;        // to tell the user we're awake
  54.     id  loadingText;        // used to say what we're loading...
  55.     id  currentSlot;        // high score slot for the game in progress
  56.         
  57.     BOOL paused;            // game is paused flag
  58.     BOOL ranOnce;            // did the player at least play one game?
  59.     BOOL initDone;            // is the game done with init sequence&alerts?
  60.     BOOL printLevel;        // which title should be put in window on print?
  61.     BOOL playerCheated;        // has the player cheated during this game?
  62.     BOOL aborting;            // is the player aborting a game in progress?
  63.     
  64.     // instance variables to hold preferences and game status:
  65.     int level, speed, tableNum;
  66. }
  67.  
  68. // access to vital "global" game objects
  69. - scoreKeeper;            // main score keeper object
  70. - highScoreController;    // high score controller object
  71. - currentHighScoreSlot;    // returns the high score slot for the game in progress
  72. - scorePlayer;            // plays music
  73. - soundPlayer;            // plays sound files
  74. - mainStrings;            // localized strings in .nib
  75. - gameScreen;            // gameView instance    
  76. - gameWindow;            // window holding gameView
  77. - gameInfo;                // returns the app's gameInfo object
  78. - oneUpView;            // returns the oneUpView object (PlayerUpView instance)
  79. - preferencesBrain;        // object to handle Preferences Panel
  80. - infoController;        // object to put out info/help panels
  81.  
  82. // misc methods
  83. - init;                    // designated initializer
  84. - (int)tableNum;        // the number of the high score table the current
  85.                         // game is eligible to be in
  86. - (int)level;            // returns current play level
  87. - (int)speed;            // returns speed
  88. - gameOver;                // end the game & wrap it up, disp. "game over" 
  89. - (int)pause;            // pause the game - internal method
  90. - (int)paused;            // are we paused?
  91. - (BOOL)playerCheated;    // did the player cheat this game?
  92. - (BOOL)aborting;        // is the player aborting a game in progress?
  93. - unpause;                // unpause the game - internal method
  94. - printGame:sender;        // print game screen w/score, level, etc.
  95. - buildNewSlot;            // builds & returns a new high score slot
  96. - makeGameInfo;            // you can override to make a custom gameinfo
  97.  
  98.     // Interface Builder (IB) methods:
  99. - pauseGame:sender;        // to be sent by menu item
  100. - startNewGame:sender;    // called by New Game menu item and on startup
  101. - unpauseGame:sender;    // same as pauseGame:
  102. - gameOver:sender;        // sent by gameScreen when game is over.
  103. - nextLevel:sender;        // advance game to next level - (for user cheat mode)
  104. - nextLevel;            // advance game to next level - internal
  105. - buildAlert;
  106. - startUp;                // deal with the GK_STARTUP app-defined event
  107. - (BOOL)askAbortGame:(int)why;    // abort:  check if user really wants to
  108. - abortGame:sender;        // above, but terminates the game if YES.
  109. - layerWindows;            // make sure the right windows are on top (stats, etc.)
  110. - appWillInit:sender;            // puts up loading alert.
  111. - appDidInit:sender;            // starts up the game on launch
  112. - appDidBecomeActive:sender;    // reactivates the game
  113. - appDidHide:sender;            // deactivates the game
  114. - appDidResignActive:sender;    // reactivates the game
  115. - appDidUnhide:sender;            // deactivates the game
  116. - appWillTerminate:sender;        // saves high scores and preferences
  117. - quit:sender;                    // to catch the "quit" menu item
  118. - applicationDefined:(NXEvent *)theEvent;    // initial startup readme panels
  119. - windowDidResginMain:sender;        // do pause if window loses main status
  120. - windowDidResignKey:sender;        // do pause if window loses key status
  121. - windowDidBecomeKey:sender;        // do unpause if window gains key status 
  122. - windowDidDeminiaturize:sender;    // clean off crap left by the new 
  123.  
  124.  
  125. @end
  126.